<!--
Template Name: login
Create author: qinglong
Create Date  : 2021-04-27
-->
<template>
  <div @keyup.enter="userlogin" class="login">
    <div class="box">
      <div class="title">管理系统</div>
      <div class="form">
        <el-form :model="form" :rules="rules">
          <el-form-item prop="username">
            <el-input v-model="form.username" size="large" placeholder="请输入账号" prefix-icon="el-icon-user"></el-input>
          </el-form-item>
          <el-form-item prop="password">
            <el-input v-model="form.password" size="large" placeholder="请输入密码" prefix-icon="el-icon-lock" show-password></el-input>
          </el-form-item>
          <el-button @click="userlogin" size="large" type="primary">登录</el-button>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
import { mapActions } from "vuex";
export default {
  name: "login",
  data() {
    return { rules: {}, form: {} };
  },
  methods: {
    ...mapActions(["login"]),
    async userlogin() {
      this.login(this.form);
    }
  }
};
</script>
<style lang='scss' scoped>
.login {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  .box {
    background: rgba($color: #ffffff, $alpha: 0.5);
    border-radius: 7px;
    box-shadow: 0 0 20px 5px rgba($color: #000000, $alpha: 0.1);
    overflow: hidden;
    padding: 30px 40px;
    width: 400px;
    margin-top: -100px;
    .title {
      height: 40px;
      text-align: center;
      font-weight: 600;
    }
    .form {
      text-align: center;
      .el-button {
        width: 100%;
      }
    }
  }
}
</style>